---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: frontend-{{ .Release.Name }}
  namespace: {{ .Release.Namespace }}
  labels:
    app: frontend
    app.kubernetes.io/instance: "{{ .Release.Name }}"
    app.kubernetes.io/version: "{{ .Chart.AppVersion }}"
    app.kubernetes.io/managed-by: "{{ .Release.Service }}"
    helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"

spec:
  replicas: {{ .Values.replicas }} 
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app: frontend
  template:
    metadata:
      labels:
        app: frontend
    spec:
      volumes:
        - name: nginx-conf
          configMap:
            name: nginx-conf
            defaultMode: 0400
      containers:
        - name: frontend
          volumeMounts:
          - name: nginx-conf
            mountPath: /etc/nginx/nginx.conf
            subPath: nginx.conf
          image: "{{ .Values.image.repository }}:{{.Values.image.tag }}"
          resources:
            requests:
              cpu: {{ .Values.requests.cpu }}
            limits:
              cpu: {{ .Values.limits.cpu }}
          imagePullPolicy: Always
          ports:
            - name: frontend
              containerPort: 80
          livenessProbe:
            httpGet:
              path: /actuator/health
              port: 80
            initialDelaySeconds: 15
            periodSeconds: 30
            timeoutSeconds: 1
            failureThreshold: 6
      imagePullSecrets:
        - name: docker-config-secret
